#! /usr/bin/python
import sys, re
def extractCFunc():
    filelist = sys.argv
    filelist.pop(0)
    for filename in filelist:
        f = open(filename, "r")
        contentlist = f.readlines()
        text = ""
        for linestr in contentlist:
            text += linestr
        f.close()
        cfuncpattern = "\s*((\w|\*)+\s+)+\**(?P<filename>\w+)\s*\(((\s*\w+\s*\**\s*){2,},?\s*)*\)";
#        m = re.search(cfuncpattern, text)
#        while m and text:
#            print text[m.start():m.end()]
#            print "======================="
#            text = text[m.end():]
#            m = re.search(cfuncpattern, text)
        for m in re.compile(cfuncpattern).finditer(text):
            print "[",m.group("filename").strip(),"]"
            print text[m.start():m.end()].strip()



extractCFunc()
